import request from '@/api/utils/request';

/* 学生信息列表 */
export const getStudentList = data =>
  request({
    method: 'post',
    url: '/schStudentDormitoryRelation/studentList',
    data: data
  });

/**
 *  excel导入住宿信息
 *  from-data格式   file :  ~~~~
 * */
export const importAccommodation = data =>
  request({
    method: 'post',
    url: '/schStudentDormitoryRelation/importAccommodation',
    data
  });

// 宿舍床位信息表

/**
 *  床位调换-位置选择-班级列表
 *
 * */
export const locationPick = () =>
  request({
    method: 'get',
    url: '/schDormitoryBed/locationPick'
  });

/**
 *  床位调换-位置选择-成员
 *
 * */
export const memberList = data =>
  request({
    method: 'get',
    url: '/schDormitoryBed/memberList',
    params: data
  });

/**
 *  床位调换
 *
 * */
export const bedExchange = data =>
  request({
    method: 'post',
    url: '/schStudentDormitoryRelation/bedExchange',
    data
  });

/**
 *  宿舍调换
 *
 * */
export const dormitoryExchange = data =>
  request({
    method: 'post',
    url: '/schStudentDormitoryRelation/dormitoryExchange',
    data
  });

/* 新增住宿 */

/**
 *  宿舍楼
 *
 * */
export const existDormitoryList = data =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/existDormitoryList?dormitoryType=' + data
  });

/**
 *  退宿
 *
 * */
export const studentCheckOut = data =>
  request({
    method: 'post',
    url: '/schStudentDormitoryRelation/studentCheckOut',
    data
  });

/**
 * 获取当前的学校id
 */
export const getSchoolId = () =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/getSchoolId'
  });

/**
 * 根据学校ID获取年级列表
 * schoolId
 */
export const getGradeListBySchoolId = schoolId =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/getGradeListBySchoolId?schoolId=' + schoolId
  });

/**
 *根据年级ID获取班级列表
 */
export const getClassListByGradeId = gradeId =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/getClassListByGradeId?gradeId=' + gradeId
  });

/**
 *通过班级ID获取学生信息列表
 */
export const getStudentListByClassId = classId =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/getStudentListByClassId?classId=' + classId
  });

/**
 *  新增住宿信息
 *
 * */
export const saveStay = data =>
  request({
    method: 'post',
    url: 'schStudentDormitoryRelation/saveStay',
    data
  });
/**
 * 批量标记住宿学生
 */
export const batchMark = data =>
  request({
    method: 'post',
    url: '/schStudentDormitoryRelation/batchMark',
    data
  });

/**
 *下载
 */
export const template = id =>
  request({
    method: 'get',
    responseType: 'blob',
    url: '/schStudentDormitoryRelation/template?excelType=' + id
  });
/**
 *查看个人信息
 */
export const studentDetail = studentUserId =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/studentDetail?studentUserId=' + studentUserId
  });
